/*    */ package com.zimbra.cs.datasource.imap;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.DataSource;
/*    */ import com.zimbra.cs.datasource.DataSourceMapping;
/*    */ import com.zimbra.cs.db.DbDataSource.DataSourceItem;
/*    */ import com.zimbra.cs.mailbox.Metadata;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class ImapMessage
/*    */   extends DataSourceMapping
/*    */ {
/*    */   private int flags;
/*    */   private long uid;
/*    */   private static final String METADATA_KEY_FLAGS = "f";
/*    */   private static final String METADATA_KEY_UID = "u";
/*    */   
/*    */   public ImapMessage(DataSource ds, DbDataSource.DataSourceItem dsi)
/*    */     throws ServiceException
/*    */   {
/* 31 */     super(ds, dsi);
/*    */   }
/*    */   
/*    */   public ImapMessage(DataSource ds, int itemId) throws ServiceException {
/* 35 */     super(ds, itemId);
/*    */   }
/*    */   
/*    */   public ImapMessage(DataSource ds, int folderId, long uid) throws ServiceException {
/* 39 */     super(ds, remoteId(folderId, uid));
/*    */   }
/*    */   
/*    */   public ImapMessage(DataSource ds, int folderId, int itemId, int flags, long uid) throws ServiceException
/*    */   {
/* 44 */     super(ds, folderId, itemId, remoteId(folderId, uid));
/* 45 */     setFlags(flags);
/* 46 */     setUid(uid);
/*    */   }
/*    */   
/*    */   public ImapMessage(DataSource ds, int folderId, int itemId, int flags, long uid, int itemFlags) throws ServiceException
/*    */   {
/* 51 */     this(ds, folderId, itemId, flags, uid);
/* 52 */     setItemFlags(itemFlags);
/*    */   }
/*    */   
/* 55 */   public int getFlags() { return this.flags; }
/*    */   
/* 57 */   public long getUid() { return this.uid; }
/*    */   
/*    */   public void setFlags(int flags) {
/* 60 */     this.dsi.md.put("f", this.flags = flags);
/*    */   }
/*    */   
/*    */   public void setUid(long uid) {
/* 64 */     this.dsi.md.put("u", this.uid = uid);
/* 65 */     setRemoteId(remoteId(this.dsi.folderId, uid));
/*    */   }
/*    */   
/*    */   protected void parseMetaData() throws ServiceException {
/* 69 */     this.flags = ((int)this.dsi.md.getLong("f", 0L));
/* 70 */     this.uid = this.dsi.md.getLong("u", 0L);
/*    */   }
/*    */   
/*    */   private static String remoteId(int folderId, long uid) {
/* 74 */     return Integer.toString(folderId) + "_" + Long.toString(uid);
/*    */   }
/*    */   
/*    */   public String toString() {
/* 78 */     return String.format("{folderId=%d,itemId=%d,remoteId=%s}", new Object[] { Integer.valueOf(getFolderId()), Integer.valueOf(getItemId()), getRemoteId() });
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/datasource/imap/ImapMessage.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */